package com.jiang.starter.web;

import com.jiang.starter.web.merge.MergeAspect;
import com.jiang.starter.web.merge.MergeExecutor;
import com.jiang.starter.web.merge.MergeInitializer;
import com.jiang.starter.web.merge.Task;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;

@Configuration
@Import({MergeInitializer.class, MergeAspect.class})
@EnableScheduling
public class MergeAutoConfiguration {

    /**
     * 每一个MergeExecutor都需要绑定一个任务队列
     */
    @Bean
    public Map<MergeExecutor<Object,Object>, BlockingQueue<Task>> executorBlockingQueueMap() {
        return new ConcurrentHashMap<>();
    }

}
